
(function() {
  var that = window.commonFunc;
  var Toast = window.toast
  var vm = new Vue({
    el: "#prize-box",
    data: {
      list:[],
      // isFill:true, // 已经填写过，去查看
      errorMsg: '出错了',
      errorDialog: false
    },
    created: function () {
      // var vConsole = new VConsole();

    },
    mounted: function() {
      this.$nextTick(function() {
        that.pixel2rem();
        this.prizeList();
      });
    },
    methods: {
      prizeList:function () {
        var _this = this;
        $.ajax({
          url:api.getPrizeList,
          data:'',
          type: 'GET',
          success:function(data){
            $('#loading').fadeOut(300)
            if(data){
              if(data.error){
                _this.errorDialog = true
                _this.errorMsg = data.msg
              }else{
                for(var i=0; i<data.myLottery.length; i++){
                  data.myLottery[i].addtime = that.formatTime(data.myLottery[i].addtime)
                }
                // console.log(_this.list)
                _this.list = data.myLottery
              }

            }
          },
          error:function(data){
            // $('#loading').fadeOut(300)
          }
        })
      },
      closeErrorDialog: function() {
        window.location.reload()
      }
    }
  });
})();
